<?php

$board = @$_REQUEST['function'];
$post_id = @$_REQUEST['v1'];
$master = @$_REQUEST['v2'];

$forum = new forum_class();

$user = new user(USER_ID);
$user_info[$user_id] = $user->load_tables('user_settings');

//echo government_setting('treasury_name');

// echo '<pre>';
// echo var_dump($user_info);
// echo '</pre>';


if ($post_id > 0)
{
	$forum->load_forum_data($board);

	$new_post = $forum->detect_new_post();
	if ($new_post)
	{
		$new_post = $forum->post($post_id,$master);
		$post_id = $new_post;
		if ($post_id > 0)
		{
			echo '<pre>posted via post</pre>';
		}
	}
		
	$forum->display_post($post_id,$master);
	
	if ($forum->type == 'talk')
	{
		echo "<div style=\"border:#7e673d 3px DASHED;width:350px;overflow:auto;\"><BR><font face=Helvecta>";
		$forum->display_replies($post_id, 1);
		echo "</font><BR><BR></div>";
	}
	
	if ($master == 0){ $master = $post_id; }
	
	$forum->display_make_post($post_id,$master);
	
}
elseif (strlen($board) > 0)
{
	$forum->load_forum_data($board);
	
	$new_post = $forum->detect_new_post();
	if ($new_post)
	{
		$new_post = $forum->post(0);
		$post_id = $new_post;
		if ($post_id > 0)
		{
			echo '<pre>posted via board</pre>';
		}
	}
	
	$forum->display_all_posts();
	
	$forum->display_make_post();
	
	
}
else 
{	
	echo '<h1>Forum</h1>';
	echo '<p>';
	echo display_text('forum');
	$forum->display_all_boards('trade','Trading Area');
	$forum->display_all_boards('talk','Discussion Area');
	echo '</p>';
}


?>